class DataManager
{
    private static s_DataManager:DataManager;
    public static getInstance():DataManager
    {
        if(this.s_DataManager == null)
        {
            this.s_DataManager = new DataManager();
        }
        return this.s_DataManager;
    }
    public constructor()
    {
        
    }
    public m_WindowsWidth:number;
    public m_WindowsHeight:number;
    public m_Config_json:Config_json;
    public m_httpData:HttpConfigData;
    public init()
    {
        this.initRoute();
        this.m_Config_json = dataConfig as Config_json;
        this.initHttp();
    }
    private initRoute()
    {
        RouteManager.getInstance().init();
    }
    private initHttp()
    {
        //HttpManager.getInstance().init(this.m_GameTypeConfig.m_HttpRequest,this.m_Config_json.url + RouteManager.getInstance().m_paraObj.gameid);
    }
    public getNameById(id:string):string
    {
        for(let i = 0; i < this.m_Config_json.commodityInfo.length; i++)
        {
            if(this.m_Config_json.commodityInfo[i].id == id)
            {
                return this.m_Config_json.commodityInfo[i].name;
            }
        }
        return "";
    }
    public getUpcById(id:string):string
    {
        for(let i = 0; i < this.m_Config_json.commodityInfo.length; i++)
        {
            if(this.m_Config_json.commodityInfo[i].id == id)
            {
                return this.m_Config_json.commodityInfo[i].upc;
            }
        }
        return "";
    }
    public getCommodityInfoById(id:string):CommodityBase
    {
        for(let i = 0; i < this.m_Config_json.commodityInfo.length; i++)
        {
            if(this.m_Config_json.commodityInfo[i].id == id)
            {
                return this.m_Config_json.commodityInfo[i];
            }
        }
        return null;
    }
}